<?php
/*
$fb = new FormBuilder('seminarWizard', $accomodationTypeForm);
$fb->setAction('next');
$fb->selectMany('accomodation_type_codes', $accomodationTypeOptions)
        ->ajaxCreateButton('/admin/accomodationType/edit')
        ->required();
$fb->write();
*/

echo form::open('admin/seminarWizard/next', array('id'=>'wizardForm'));
?>

<table class="pricesTable">
    <thead>
        <tr>
            <th></th>
            <?php
            foreach ($this->data->batchList as $batchIndex => $batch) {
                echo '<th>' . $batch['name'] . '<br/>' . format::date($batch['begin_date']) . ' - ' . format::date($batch['end_date']) . '</th>';
            }
            ?>
        </tr>
    </thead>
    <tbody>
        <?php
        $rowNumber = 1;
        foreach ($accomodationTypeList as $accomodationType) {
            echo '<tr' . ($rowNumber % 2 == 1 ? ' class="oddRow"' : '') . '>';
            echo '<th><span class="textWithAction" onclick="checkOrUncheckAllInRow(this.parentNode.parentNode)" title="' . text::getEscaped('seminarWizard.clickToSelectAllBatchesOrNone') . '">' . $accomodationType['name'] . '<span></th>';
            foreach ($this->data->batchList as $batchIndex => $batch) {
                echo '<td>';
                echo form::checkbox('accomodationBatch[' . $accomodationType['code'] . '][]',
                        $batchIndex,
                        $accomodationBatch[$accomodationType['code']] && (array_search($batchIndex, $accomodationBatch[$accomodationType['code']]) !== FALSE));
                echo '</td>';
            }
            echo '</tr>';
            $rowNumber ++;
        }
        ?>
    </tbody>
</table>

<?php
if ($this->data->seminar['singleDaysAllowed']) {
	echo '<h3>' . text::getEscaped('seminarWizard-accomodationType-singleDays') . '</h3>';
	echo '<p class="description">' . text::getEscaped('seminarWizard-accomodationType-singleDays-info') . '</p>';
	
	$fb = new FormBuilder('seminarWizard', $formData);
	$fb->doNotOpenForm();
	$fb->doNotCloseForm();
	$fb->selectMany('singleDayAccommodationType_codes', $singleDayAccommodationTypeOptions)->required();
	$fb->write();
}
?>

</form>